package com.ruoyi.web.controller.system;


import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.ResponseResult;
import com.ruoyi.system.domain.Cash;
import com.ruoyi.system.service.CountService;
import com.ruoyi.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "管理后台:统计相关接口")
@RestController
@RequestMapping("/admin/count")
public class AdminCountController extends AdminController {
    @Resource
    private CountService countService;
    @Resource
    private ISysUserService userService;


    @ApiOperation(value = "首页统计")
    @GetMapping("index")
    public ResponseResult<List<Cash>> list(Cash Cash) {
        Long merchantId = this.getUserId();

        SysUser user = userService.check(merchantId);

        Object count = countService.count(merchantId,user.getRole());
        return this.setSuccessResult(count);
    }


}
